open Color;

let transparentWhite = rgba(1.0, 1.0, 1.0, 0.0);
let transparentBlack = rgba(0., 0., 0., 0.);

let aliceBlue = rgb(0.94, 0.97, 1.0);
let antiqueWhite = rgb(0.98, 0.92, 0.84);
let aqua = rgb(0.0, 1.0, 1.0);
let aquamarine = rgb(0.5, 1.0, 0.83);
let azure = rgb(0.94, 1.0, 1.0);
let beige = rgb(0.96, 0.96, 0.86);
let bisque = rgb(1.0, 0.89, 0.77);
let black = rgb(0.0, 0.0, 0.0);
let blanchedAlmond = rgb(1.0, 0.92, 0.8);
let blue = rgb(0.0, 0.0, 1.0);
let blueViolet = rgb(0.54, 0.17, 0.89);
let brown = rgb(0.65, 0.16, 0.16);
let burlyWood = rgb(0.87, 0.72, 0.53);
let cadetBlue = rgb(0.37, 0.62, 0.63);
let chartreuse = rgb(0.5, 1.0, 0.0);
let chocolate = rgb(0.82, 0.41, 0.12);
let coral = rgb(1.0, 0.5, 0.31);
let cornflowerBlue = rgb(0.39, 0.58, 0.93);
let cornsilk = rgb(1.0, 0.97, 0.86);
let crimson = rgb(0.86, 0.08, 0.24);
let cyan = rgb(0.0, 1.0, 1.0);
let darkBlue = rgb(0.0, 0.0, 0.55);
let darkCyan = rgb(0.0, 0.55, 0.55);
let darkGoldenRod = rgb(0.72, 0.53, 0.04);
let darkGray = rgb(0.66, 0.66, 0.66);
let darkGrey = rgb(0.66, 0.66, 0.66);
let darkGreen = rgb(0.0, 0.39, 0.0);
let darkKhaki = rgb(0.74, 0.72, 0.42);
let darkMagenta = rgb(0.55, 0.0, 0.55);
let darkOliveGreen = rgb(0.33, 0.42, 0.18);
let darkOrange = rgb(1.0, 0.55, 0.0);
let darkOrchid = rgb(0.6, 0.2, 0.8);
let darkRed = rgb(0.55, 0.0, 0.0);
let darkSalmon = rgb(0.91, 0.59, 0.48);
let darkSeaGreen = rgb(0.56, 0.74, 0.56);
let darkSlateBlue = rgb(0.28, 0.24, 0.55);
let darkSlateGray = rgb(0.18, 0.31, 0.31);
let darkSlateGrey = rgb(0.18, 0.31, 0.31);
let darkTurquoise = rgb(0.0, 0.81, 0.82);
let darkViolet = rgb(0.58, 0.0, 0.83);
let deepPink = rgb(1.0, 0.08, 0.58);
let deepSkyBlue = rgb(0.0, 0.75, 1.0);
let dimGray = rgb(0.41, 0.41, 0.41);
let dimGrey = rgb(0.41, 0.41, 0.41);
let dodgerBlue = rgb(0.12, 0.56, 1.0);
let fireBrick = rgb(0.7, 0.13, 0.13);
let floralWhite = rgb(1.0, 0.98, 0.94);
let forestGreen = rgb(0.13, 0.55, 0.13);
let fuchsia = rgb(1.0, 0.0, 1.0);
let gainsboro = rgb(0.86, 0.86, 0.86);
let ghostWhite = rgb(0.97, 0.97, 1.0);
let gold = rgb(1.0, 0.84, 0.0);
let goldenRod = rgb(0.85, 0.65, 0.13);
let gray = rgb(0.5, 0.5, 0.5);
let grey = rgb(0.5, 0.5, 0.5);
let green = rgb(0.0, 0.5, 0.0);
let greenYellow = rgb(0.68, 1.0, 0.18);
let honeyDew = rgb(0.94, 1.0, 0.94);
let hotPink = rgb(1.0, 0.41, 0.71);
let indianRed = rgb(0.8, 0.36, 0.36);
let indigo = rgb(0.29, 0.0, 0.51);
let ivory = rgb(1.0, 1.0, 0.94);
let khaki = rgb(0.94, 0.9, 0.55);
let lavender = rgb(0.9, 0.9, 0.98);
let lavenderBlush = rgb(1.0, 0.94, 0.96);
let lawnGreen = rgb(0.49, 0.99, 0.0);
let lemonChiffon = rgb(1.0, 0.98, 0.8);
let lightBlue = rgb(0.68, 0.85, 0.9);
let lightCoral = rgb(0.94, 0.5, 0.5);
let lightCyan = rgb(0.88, 1.0, 1.0);
let lightGoldenRodYellow = rgb(0.98, 0.98, 0.82);
let lightGray = rgb(0.83, 0.83, 0.83);
let lightGrey = rgb(0.83, 0.83, 0.83);
let lightGreen = rgb(0.56, 0.93, 0.56);
let lightPink = rgb(1.0, 0.71, 0.76);
let lightSalmon = rgb(1.0, 0.63, 0.48);
let lightSeaGreen = rgb(0.13, 0.7, 0.67);
let lightSkyBlue = rgb(0.53, 0.81, 0.98);
let lightSlateGray = rgb(0.47, 0.53, 0.6);
let lightSlateGrey = rgb(0.47, 0.53, 0.6);
let lightSteelBlue = rgb(0.69, 0.77, 0.87);
let lightYellow = rgb(1.0, 1.0, 0.88);
let lime = rgb(0.0, 1.0, 0.0);
let limeGreen = rgb(0.2, 0.8, 0.2);
let linen = rgb(0.98, 0.94, 0.9);
let magenta = rgb(1.0, 0.0, 1.0);
let maroon = rgb(0.5, 0.0, 0.0);
let mediumAquaMarine = rgb(0.4, 0.8, 0.67);
let mediumBlue = rgb(0.0, 0.0, 0.8);
let mediumOrchid = rgb(0.73, 0.33, 0.83);
let mediumPurple = rgb(0.58, 0.44, 0.86);
let mediumSeaGreen = rgb(0.24, 0.7, 0.44);
let mediumSlateBlue = rgb(0.48, 0.41, 0.93);
let mediumSpringGreen = rgb(0.0, 0.98, 0.6);
let mediumTurquoise = rgb(0.28, 0.82, 0.8);
let mediumVioletRed = rgb(0.78, 0.08, 0.52);
let midnightBlue = rgb(0.1, 0.1, 0.44);
let mintCream = rgb(0.96, 1.0, 0.98);
let mistyRose = rgb(1.0, 0.89, 0.88);
let moccasin = rgb(1.0, 0.89, 0.71);
let navajoWhite = rgb(1.0, 0.87, 0.68);
let navy = rgb(0.0, 0.0, 0.5);
let oldLace = rgb(0.99, 0.96, 0.9);
let olive = rgb(0.5, 0.5, 0.0);
let oliveDrab = rgb(0.42, 0.56, 0.14);
let orange = rgb(1.0, 0.65, 0.0);
let orangeRed = rgb(1.0, 0.27, 0.0);
let orchid = rgb(0.85, 0.44, 0.84);
let paleGoldenRod = rgb(0.93, 0.91, 0.67);
let paleGreen = rgb(0.6, 0.98, 0.6);
let paleTurquoise = rgb(0.69, 0.93, 0.93);
let paleVioletRed = rgb(0.86, 0.44, 0.58);
let papayaWhip = rgb(1.0, 0.94, 0.84);
let peachPuff = rgb(1.0, 0.85, 0.73);
let peru = rgb(0.8, 0.52, 0.25);
let pink = rgb(1.0, 0.75, 0.8);
let plum = rgb(0.87, 0.63, 0.87);
let powderBlue = rgb(0.69, 0.88, 0.9);
let purple = rgb(0.5, 0.0, 0.5);
let rebeccaPurple = rgb(0.4, 0.2, 0.6);
let red = rgb(1.0, 0.0, 0.0);
let rosyBrown = rgb(0.74, 0.56, 0.56);
let royalBlue = rgb(0.25, 0.41, 0.88);
let saddleBrown = rgb(0.55, 0.27, 0.07);
let salmon = rgb(0.98, 0.5, 0.45);
let sandyBrown = rgb(0.96, 0.64, 0.38);
let seaGreen = rgb(0.18, 0.55, 0.34);
let seaShell = rgb(1.0, 0.96, 0.93);
let sienna = rgb(0.63, 0.32, 0.18);
let silver = rgb(0.75, 0.75, 0.75);
let skyBlue = rgb(0.53, 0.81, 0.92);
let slateBlue = rgb(0.42, 0.35, 0.8);
let slateGray = rgb(0.44, 0.5, 0.56);
let slateGrey = rgb(0.44, 0.5, 0.56);
let snow = rgb(1.0, 0.98, 0.98);
let springGreen = rgb(0.0, 1.0, 0.5);
let steelBlue = rgb(0.27, 0.51, 0.71);
let tan = rgb(0.82, 0.71, 0.55);
let teal = rgb(0.0, 0.5, 0.5);
let thistle = rgb(0.85, 0.75, 0.85);
let tomato = rgb(1.0, 0.39, 0.28);
let turquoise = rgb(0.25, 0.88, 0.82);
let violet = rgb(0.93, 0.51, 0.93);
let wheat = rgb(0.96, 0.87, 0.7);
let white = rgb(1.0, 1.0, 1.0);
let whiteSmoke = rgb(0.96, 0.96, 0.96);
let yellow = rgb(1.0, 1.0, 0.0);
let yellowGreen = rgb(0.6, 0.8, 0.2);

let lookup = Hashtbl.create(150);
Hashtbl.add(lookup, "aliceblue", aliceBlue);
Hashtbl.add(lookup, "antiquewhite", antiqueWhite);
Hashtbl.add(lookup, "aqua", aqua);
Hashtbl.add(lookup, "aquamarine", aquamarine);
Hashtbl.add(lookup, "azure", azure);
Hashtbl.add(lookup, "beige", beige);
Hashtbl.add(lookup, "bisque", bisque);
Hashtbl.add(lookup, "black", black);
Hashtbl.add(lookup, "blanchedalmond", blanchedAlmond);
Hashtbl.add(lookup, "blue", blue);
Hashtbl.add(lookup, "blueviolet", blueViolet);
Hashtbl.add(lookup, "brown", brown);
Hashtbl.add(lookup, "burlywood", burlyWood);
Hashtbl.add(lookup, "cadetblue", cadetBlue);
Hashtbl.add(lookup, "chartreuse", chartreuse);
Hashtbl.add(lookup, "chocolate", chocolate);
Hashtbl.add(lookup, "coral", coral);
Hashtbl.add(lookup, "cornflowerblue", cornflowerBlue);
Hashtbl.add(lookup, "cornsilk", cornsilk);
Hashtbl.add(lookup, "crimson", crimson);
Hashtbl.add(lookup, "cyan", cyan);
Hashtbl.add(lookup, "darkblue", darkBlue);
Hashtbl.add(lookup, "darkcyan", darkCyan);
Hashtbl.add(lookup, "darkgoldenrod", darkGoldenRod);
Hashtbl.add(lookup, "darkgray", darkGray);
Hashtbl.add(lookup, "darkgrey", darkGrey);
Hashtbl.add(lookup, "darkgreen", darkGreen);
Hashtbl.add(lookup, "darkkhaki", darkKhaki);
Hashtbl.add(lookup, "darkmagenta", darkMagenta);
Hashtbl.add(lookup, "darkolivegreen", darkOliveGreen);
Hashtbl.add(lookup, "darkorange", darkOrange);
Hashtbl.add(lookup, "darkorchid", darkOrchid);
Hashtbl.add(lookup, "darkred", darkRed);
Hashtbl.add(lookup, "darksalmon", darkSalmon);
Hashtbl.add(lookup, "darkseagreen", darkSeaGreen);
Hashtbl.add(lookup, "darkslateblue", darkSlateBlue);
Hashtbl.add(lookup, "darkslategray", darkSlateGray);
Hashtbl.add(lookup, "darkslategrey", darkSlateGrey);
Hashtbl.add(lookup, "darkturquoise", darkTurquoise);
Hashtbl.add(lookup, "darkviolet", darkViolet);
Hashtbl.add(lookup, "deeppink", deepPink);
Hashtbl.add(lookup, "deepskyblue", deepSkyBlue);
Hashtbl.add(lookup, "dimgray", dimGray);
Hashtbl.add(lookup, "dimgrey", dimGrey);
Hashtbl.add(lookup, "dodgerblue", dodgerBlue);
Hashtbl.add(lookup, "firebrick", fireBrick);
Hashtbl.add(lookup, "floralwhite", floralWhite);
Hashtbl.add(lookup, "forestgreen", forestGreen);
Hashtbl.add(lookup, "fuchsia", fuchsia);
Hashtbl.add(lookup, "gainsboro", gainsboro);
Hashtbl.add(lookup, "ghostwhite", ghostWhite);
Hashtbl.add(lookup, "gold", gold);
Hashtbl.add(lookup, "goldenrod", goldenRod);
Hashtbl.add(lookup, "gray", gray);
Hashtbl.add(lookup, "grey", grey);
Hashtbl.add(lookup, "green", green);
Hashtbl.add(lookup, "greenyellow", greenYellow);
Hashtbl.add(lookup, "honeydew", honeyDew);
Hashtbl.add(lookup, "hotpink", hotPink);
Hashtbl.add(lookup, "indianred", indianRed);
Hashtbl.add(lookup, "indigo", indigo);
Hashtbl.add(lookup, "ivory", ivory);
Hashtbl.add(lookup, "khaki", khaki);
Hashtbl.add(lookup, "lavender", lavender);
Hashtbl.add(lookup, "lavenderblush", lavenderBlush);
Hashtbl.add(lookup, "lawngreen", lawnGreen);
Hashtbl.add(lookup, "lemonchiffon", lemonChiffon);
Hashtbl.add(lookup, "lightblue", lightBlue);
Hashtbl.add(lookup, "lightcoral", lightCoral);
Hashtbl.add(lookup, "lightcyan", lightCyan);
Hashtbl.add(lookup, "lightgoldenrodyellow", lightGoldenRodYellow);
Hashtbl.add(lookup, "lightgray", lightGray);
Hashtbl.add(lookup, "lightgrey", lightGrey);
Hashtbl.add(lookup, "lightgreen", lightGreen);
Hashtbl.add(lookup, "lightpink", lightPink);
Hashtbl.add(lookup, "lightsalmon", lightSalmon);
Hashtbl.add(lookup, "lightseagreen", lightSeaGreen);
Hashtbl.add(lookup, "lightskyblue", lightSkyBlue);
Hashtbl.add(lookup, "lightslategray", lightSlateGray);
Hashtbl.add(lookup, "lightslategrey", lightSlateGrey);
Hashtbl.add(lookup, "lightsteelblue", lightSteelBlue);
Hashtbl.add(lookup, "lightyellow", lightYellow);
Hashtbl.add(lookup, "lime", lime);
Hashtbl.add(lookup, "limegreen", limeGreen);
Hashtbl.add(lookup, "linen", linen);
Hashtbl.add(lookup, "magenta", magenta);
Hashtbl.add(lookup, "maroon", maroon);
Hashtbl.add(lookup, "mediumaquamarine", mediumAquaMarine);
Hashtbl.add(lookup, "mediumblue", mediumBlue);
Hashtbl.add(lookup, "mediumorchid", mediumOrchid);
Hashtbl.add(lookup, "mediumpurple", mediumPurple);
Hashtbl.add(lookup, "mediumseagreen", mediumSeaGreen);
Hashtbl.add(lookup, "mediumslateblue", mediumSlateBlue);
Hashtbl.add(lookup, "mediumspringgreen", mediumSpringGreen);
Hashtbl.add(lookup, "mediumturquoise", mediumTurquoise);
Hashtbl.add(lookup, "mediumvioletred", mediumVioletRed);
Hashtbl.add(lookup, "midnightblue", midnightBlue);
Hashtbl.add(lookup, "mintcream", mintCream);
Hashtbl.add(lookup, "mistyrose", mistyRose);
Hashtbl.add(lookup, "moccasin", moccasin);
Hashtbl.add(lookup, "navajowhite", navajoWhite);
Hashtbl.add(lookup, "navy", navy);
Hashtbl.add(lookup, "oldlace", oldLace);
Hashtbl.add(lookup, "olive", olive);
Hashtbl.add(lookup, "olivedrab", oliveDrab);
Hashtbl.add(lookup, "orange", orange);
Hashtbl.add(lookup, "orangered", orangeRed);
Hashtbl.add(lookup, "orchid", orchid);
Hashtbl.add(lookup, "palegoldenrod", paleGoldenRod);
Hashtbl.add(lookup, "palegreen", paleGreen);
Hashtbl.add(lookup, "paleturquoise", paleTurquoise);
Hashtbl.add(lookup, "palevioletred", paleVioletRed);
Hashtbl.add(lookup, "papayawhip", papayaWhip);
Hashtbl.add(lookup, "peachpuff", peachPuff);
Hashtbl.add(lookup, "peru", peru);
Hashtbl.add(lookup, "pink", pink);
Hashtbl.add(lookup, "plum", plum);
Hashtbl.add(lookup, "powderblue", powderBlue);
Hashtbl.add(lookup, "purple", purple);
Hashtbl.add(lookup, "rebeccapurple", rebeccaPurple);
Hashtbl.add(lookup, "red", red);
Hashtbl.add(lookup, "rosybrown", rosyBrown);
Hashtbl.add(lookup, "royalblue", royalBlue);
Hashtbl.add(lookup, "saddlebrown", saddleBrown);
Hashtbl.add(lookup, "salmon", salmon);
Hashtbl.add(lookup, "sandybrown", sandyBrown);
Hashtbl.add(lookup, "seagreen", seaGreen);
Hashtbl.add(lookup, "seashell", seaShell);
Hashtbl.add(lookup, "sienna", sienna);
Hashtbl.add(lookup, "silver", silver);
Hashtbl.add(lookup, "skyblue", skyBlue);
Hashtbl.add(lookup, "slateblue", slateBlue);
Hashtbl.add(lookup, "slategray", slateGray);
Hashtbl.add(lookup, "slategrey", slateGrey);
Hashtbl.add(lookup, "snow", snow);
Hashtbl.add(lookup, "springgreen", springGreen);
Hashtbl.add(lookup, "steelblue", steelBlue);
Hashtbl.add(lookup, "tan", tan);
Hashtbl.add(lookup, "teal", teal);
Hashtbl.add(lookup, "thistle", thistle);
Hashtbl.add(lookup, "tomato", tomato);
Hashtbl.add(lookup, "turquoise", turquoise);
Hashtbl.add(lookup, "violet", violet);
Hashtbl.add(lookup, "wheat", wheat);
Hashtbl.add(lookup, "white", white);
Hashtbl.add(lookup, "whitesmoke", whiteSmoke);
Hashtbl.add(lookup, "yellow", yellow);
Hashtbl.add(lookup, "yellowgreen", yellowGreen);

let fromString = name =>
  Hashtbl.find_opt(lookup, String.lowercase_ascii(name));
let fromStringExn = name =>
  try(Hashtbl.find(lookup, String.lowercase_ascii(name))) {
  | Not_found => failwith("Unknown color: " ++ name)
  };
